package com.xmuexp109.exp5.model;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

/**
 * 订单明细返回视图对象,用于向用户返回查询数据
 **/
@Data
@ApiModel(description = "订单明细返回视图对象")
public class orderItemRetVo {
    @ApiModelProperty(value = "sku号")
    private Long goodsSkuId;

    @ApiModelProperty(value = "订单号")
    private Long orderId;

    @ApiModelProperty(value = "商品名称")
    private String name;

    @ApiModelProperty(value = "数量")
    private Integer quantity;

    @ApiModelProperty(value = "商品单价")
    private Long price;

    @ApiModelProperty(value = "折让数目")
    private Long discount;

    @ApiModelProperty(value = "优惠活动id")
    private Long couponActivityId;

    @ApiModelProperty(value = "分享成功的id")
    private Long beShareId;

    /**
     * 由Vo对象创建orderItem对象
     * @return orderItem对象
     */
    public orderItemRetVo(orderItem orderItem){
        this.goodsSkuId=orderItem.getGoodsSkuId();
        this.orderId=orderItem.getOrderId();
        this.name=orderItem.getName();
        this.quantity=orderItem.getQuantity();
        this.price=orderItem.getPrice();
        this.discount = orderItem.getDiscount();
        this.couponActivityId=orderItem.getCouponActivityId();
        this.beShareId=orderItem.getBeShareId();
    }
}
